﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace Spider.Lib
{
    public static class StringFactory
    {
        public static string ThreadState
        {
            get; set;
        }
        public static string AppDir
        {
            get
            {
                return AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "");
            }
        }
        static XmlDocument BaseConfig
        {
            get
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(AppDir + "BaseConfig.xml");

                return doc;
            }
        }

        public static string WebSiteDir
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/WebSiteDir").InnerText;

            }
        }
        public static string ConnectionString
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/ConnectionString").InnerText;

            }
        }

        public static string Category
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/Category").InnerText;

            }
        }
        public static string Tag
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/Tag").InnerText;

            }
        }
        public static string Filter
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/Filter").InnerText;

            }
        }

        public static string WaterMarkJpg
        {
            get
            {
                return BaseConfig.SelectSingleNode("BaseConfigInfo/WaterMarkJpg").InnerText;

            }
        }

        public static int ImgHeigh
        {
            get
            {
                return int.Parse(BaseConfig.SelectSingleNode("BaseConfigInfo/ImgHeigh").InnerText);

            }
        }
        public static bool EnableMark
        {
            get
            {
                return bool.Parse(BaseConfig.SelectSingleNode("BaseConfigInfo/EnableMark").InnerText);

            }
        }
    }
}
